Skip to content

Show the Charge Point sessions tooltip again after the move to ECharts - #2829

Merged
Flix6x merged 9 commits into
mainfrom
claude/sessions-chart-tooltip-64285d
Nov 8, 2026
Merged

Flix6x merged 9 commits into
mainfrom
claude/sessions-chart-tooltip-64285d

Conversation

@Ahmad-Wahid

@Ahmad-Wahid Ahmad-Wahid commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2828.

Problem

Hovering a session bar in the Charge Points chart showed no tooltip since the switch to ECharts.
A line series only answers hover through its symbols, which carry the data index the item tooltip needs.
The session bars were bare 2-point lines, and their invisible hit-area series had no symbols and a disabled tooltip, so no hover event ever fired.
The redirect meant to cover for that never ran.

Fix

  • The hit-area series now has large invisible symbols (100 per bar) and its own tooltip, and sits above the visible line, which would otherwise be the element under the cursor.
  • Removed wireSessionTooltipRedirect.

Tests

  • New test_hovering_a_session_bar_shows_its_tooltip drives the real ECharts library with mouse events on two bar layers; it fails without the fix.
  • The JS test harness serves the vendored ECharts, and the test skips when it is not downloaded.
  • Not covered: touch taps.

Looks like:

image

A line series only answers hover through its symbols, which carry the data index the item tooltip needs.
The session bars were bare 2-point lines whose invisible hit-area series had no symbols and a disabled tooltip,
so nothing ever fired on hover, and the redirect that was meant to cover for it never ran.
The hit-area series now has large invisible symbols and its own tooltip, and sits above the visible line, which would otherwise be the element under the cursor.
The redirect is gone.

The new test drives the real ECharts library with mouse events, which the formatter-only test could not.

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@Ahmad-Wahid Ahmad-Wahid self-assigned this Nov 5, 2026
@read-the-docs-community

read-the-docs-community Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The ruler is linked across subplots, so ECharts also reports the points of the other subplots at the ruler's time.
The formatter picked the nearest of all of them, so hovering empty space in one subplot could show another subplot's point.
It now ignores every point outside the subplot the pointer is in.

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
Each session now has one invisible hit rectangle spanning its earliest to its latest timestamp,
drawn by a custom series in pixel space, instead of a row of symbols spaced in time that left gaps once zoomed in.
Its tooltip lists all of the session's timestamps.
Zooming also no longer drops the points outside the window on this chart, which made a session vanish when zoomed into its middle.

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@Flix6x Flix6x added bug Something isn't working UI labels Nov 6, 2026
@Flix6x Flix6x added this to the 1.2.0 milestone Nov 6, 2026

@Flix6x Flix6x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this works well: hovering anywhere on a session now shows the full tooltip, also when zoomed far in, and the subplot scoping holds up for taps too. I ran the JS tests with the vendored ECharts (all 22 pass, none skipped), and both new tests fail against main's fast-chart.js, so they catch the bug. A nice side effect: the legend colours now match the session bars (on main, Charger 5 was green in the legend but orange in the chart).

Two behaviour regressions are inline, plus the changelog placement and some nits.

This review was drafted with Claude, which tested the PR against the real chart in headless Chrome. If any of the suggestions look off to you, ping me and we'll discuss.

Comment thread flexmeasures/ui/static/js/fast-chart.js Resolved
Comment thread flexmeasures/ui/static/js/fast-chart.js Resolved
Comment thread documentation/changelog.rst Resolved
Comment thread flexmeasures/ui/static/js/fast-chart.js Resolved
Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
…ons survive

The 'none' filter mode kept every point on zoom, which stopped the companion subplots' y-axes rescaling to the visible data.
weakFilter keeps that rescaling, and keeps a session segment whose two ends are both out of view
because each of its points now carries both ends of the segment as x-dimensions.
The session lines are native line series again, so the legend's hover highlight and dimming work as they did.
Also: define the hit height before its use, and tidy the new tests (one convertToPixel call, a shared ECharts loader).

Signed-off-by: Ahmad-Wahid <ahmedwahid16101@gmail.com>
@Ahmad-Wahid

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review, Felix. All points are addressed in 844a911 and ac707b6 (plus a merge of main, no rebase).

Zoom regression. Right, filterMode: "none" stopped the companion y-axes rescaling. Both zooms now use weakFilter. I did not take the custom-series route for the visible bars: I tried it, but custom items do not take part in the legend's hover highlight (no focus/blur data), so the other chargers never dimmed. Instead each point of a session line carries both ends of its segment as x-dimensions (encode: { x: [0, 2] }). weakFilter only drops a point when all of its x-dimensions are out of the window on the same side, so a segment whose two ends are both out of view is kept. The lines are native line series again.

Legend highlight. Restored with your emphasis suggestion; in a browser, highlighting Charger 4 thickens its lines and dims Charger 5's.

Changelog. Merged main and moved the entry to v1.2.0 Bugfixes.

Nits. SESSION_HIT_HEIGHT now sits above buildSessionHitSeries; the tests use a single convertToPixel call and share one ECharts loader.

A new test, test_zooming_keeps_sessions_and_rescales_the_companion_subplots, covers your 1000 kW / 30 kW case. It fails with filterMode: "none" (power axis stays at 1000) and with the default filter (the session vanishes). All 167 JS tests pass.

Not covered: the drag-to-zoom (marquee) tool also uses weakFilter now, but no test exercises it, and I only checked zooms and highlights by dispatching actions, not with wheel, pan or legend-hover input.

The ruler highlights the point nearest in time on every linked subplot,
and in the sessions subplot that is often a point of another charger's session,
which then thickened while the hovered session stayed as it was.
The sessions axis no longer lets its ruler highlight anything; hover over a session is answered by the session's own hit area.
The ruler on the companion subplots still highlights their points.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DWv6v4u9asHS25hW25jdvV
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x

Flix6x commented Nov 8, 2026

Copy link
Copy Markdown
Member

Thanks @Ahmad-Wahid, all points are addressed. I re-checked them in a browser against the real chart: the power axis rescales on zoom again (0–35 instead of 0–1000), sessions survive a mid-session zoom, and legend hover highlights and dims as before.

While re-checking, I found one more glitch and pushed a fix myself in 03cdb91, to save a round trip. Hovering a Charger 4 session thickened a Charger 5 bar. The ruler highlights the point nearest in time on every linked subplot, and in the sessions subplot that is often another charger's session. This was already the case on main (worse there: it also faded the hovered charger out), and it only became visible here once the legend emphasis came back.

The fix sets triggerEmphasis: false on the sessions x-axis pointer only, so the ruler still highlights the power point below a hovered session. I tried setting it for the whole chart, but that loses this power-point highlight. The new test test_hovering_a_session_highlights_no_other_charger fails without the fix and passes with it. All 168 JS tests pass, and I added a few words to the changelog entry.

Found and fixed with Claude. If you see a problem with it, ping me.

@Flix6x Flix6x left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with my fix for the cross-charger highlight on top (see above).

Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x
Flix6x merged commit 7d1c8d1 into main Nov 8, 2026
13 checks passed
@Flix6x
Flix6x deleted the claude/sessions-chart-tooltip-64285d branch November 8, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charge Point sessions chart shows no tooltip on hover since the switch to ECharts

2 participants